package com.itboye.ihomebank.responsitory;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.ihomebank.base.BaseNetRepository;
import com.itboye.ihomebank.base.ICompleteListener;
import com.itboye.ihomebank.bean.HouseBean;
import com.itboye.ihomebank.interfaces.KeyInterface;
import com.itboye.ihomebank.net.BaseErrorListener;
import com.itboye.ihomebank.net.BaseSuccessReqListener;
import com.itboye.ihomebank.net.ByJsonRequest.Builder;
/***
 * 钥匙请求网络类
 * 
 */
public class KeyRepository extends BaseNetRepository implements KeyInterface<HouseBean>{

	String api = "100";
	
	String register = "BY_Sciener_reg";// 注册
	
	public KeyRepository(ICompleteListener iCompleteListener) {
		super(iCompleteListener);
	}
	
	/**
	 * 注册
	 */
	@Override
	public void getRegister(String uid) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(register, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
		
	}

}
